package com.bilibili.juc.reference;

/**
 * @author zuife
 * @description
 * @since 2024-05-05 20:07:24
 */
public class StrongReference {
    public static void main(String[] args) {
        MyObject myObject =new MyObject();
        System.out.println("gc before : "+ myObject);
        myObject = null;
        System.gc(); //人工开启GC，一般不用 调用垃圾回收器
        //暂停3秒，保证上面的操作执行完
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("gc after : "+ myObject);

    }
}

